package controller.action;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;

import model.service.FileService;

import com.opensymphony.xwork2.ActionSupport;

public class ExcelDownload extends ActionSupport{
	private String className;
	private String epId;
	private String Info;
	private InputStream inputStream;
	private FileService fileService; 
	public String getClassName() {
		return className;
	}
	public void setEpId(String epId) {
		this.epId = epId;
	}

	public String getEpId() {
		return epId;
	}
	////	private String result;
//	
//	public String getResult() {
//		return result;
//	}
	public InputStream getInputStream() {
		return inputStream;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public void setInfo(String Info) {
		this.Info = Info;
	}
	public void setFileService(FileService fileService) {
		this.fileService = fileService;
	}
	public String fileDownload()
	{
//		setClassName("User");
		
		System.out.println(epId);
		inputStream=fileService.toExcel(className,Info,epId);;
	
		if(inputStream==null)
			return ERROR;
		return SUCCESS;
	}
	public String Download()
	{
		inputStream = fileService.toExcel(className, Info);
		if(inputStream==null)
			return ERROR;
		return SUCCESS;
	}
}
